import {
  postRequest,
  getRequest,
  putRequest,
  deleteRequest
} from '@/utils/request'

export const login = params => {
  return postRequest('/login', params, false).then(data => {
    return data
  })
}

export const getInfo = params => {
  return getRequest('/permissions/current', params).then(data => {
    return data
  })
}

export const requestUsers = params => {
  return getRequest('/users', params)
}

export const logout = params => {
  return postRequest('/logout', params)
}

export const requestAllPage = params => {
  return getRequest('/permissions', params)
}

export const requestEditUser = params => {
  return putRequest('/users', params)
}

export const requestAllProjects = params => {
  return getRequest('/projects/all', params)
}

export const requestAddUser = params => {
  return postRequest('/users', params)
}

export const deleteUser = params => {
  return deleteRequest('/users/' + params)
}

export const requestResetPassWord = params => {
  return putRequest('/users/resetPassword', params, false)
}
